package com.chenjun.controller;

import com.chenjun.domain.pojo.Restaurant;
import com.chenjun.domain.pojo.TestUser;
import com.chenjun.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private TestService service;
    @GetMapping("/restaurants")
    public List<Restaurant> getRestaurants() {
        return List.of(
                new Restaurant("惊喜餐厅", "市中心", "特色美食")
        );
    }
    @GetMapping("/getAll")
    public List<TestUser> getData(){
       List<TestUser> tuList = service.getAll();
       return tuList;
    }

    @GetMapping
    public String testGet(){
        return "hellow 你好";
    }


}
